Skip to main content

Predefined Cards

Overview

The SDKFakeCardProvider class is a utility object designed to create fake card instances for testing card reader functionalities. It provides various methods to simulate different types of cards (e.g., magnetic stripe, contactless, contact) and configurations such as CVM results and multiple EMV applications.

This utility simplifies the process of generating cards with predefined attributes, enabling robust and customizable testing scenarios.

providesSwipeWithoutPin

Creates a magnetic stripe card that does not require PIN verification. This method simulates a card with a magnetic stripe that can be used in testing scenarios where PIN entry is not needed.

Parameters:

  • cardBrand (SDKFakeCardBrand): The brand of the card.

Returns:

  • SDKFakeCard.Magnetic: A fake magnetic stripe card object with predefined attributes.
val card = SDKFakeCardProvider.providesSwipeWithoutPin(SDKFakeCardBrand.Visa)

This will only work if an SDKSwipePinDecider has not been configured using the setSwipePinDecider function in the SDKPaymentsConfiguration class. Otherwise, the behavior will be defined by the implementer.

providesSwipeWithPin

Creates a magnetic stripe card that requires PIN verification. This method simulates a card with a magnetic stripe for testing scenarios where PIN entry is mandatory.

Parameters:

  • cardBrand (SDKFakeCardBrand): The brand of the card.

Returns:

  • SDKFakeCard.Magnetic: A fake magnetic stripe card object with predefined attributes.
val card = SDKFakeCardProvider.providesSwipeWithPin(SDKFakeCardBrand.Master)

This will only work if an SDKSwipePinDecider has not been configured using the setSwipePinDecider function in the SDKPaymentsConfiguration class. Otherwise, the behavior will be defined by the implementer.

providesContactless

Creates a contactless card with customizable CVM (Cardholder Verification Method) results. This method simulates a contactless card for testing scenarios that involve tap-to-pay or NFC payments.

Parameters:

  • cardBrand (SDKFakeCardBrand): The brand of the card.
  • cvmResult (SDKCvmResult): The CVM result for the card.

Returns:

  • SDKFakeCard.Emv.Contactless: A fake contactless card object with predefined attributes.
val card = SDKFakeCardProvider.providesContactless(
cardBrand = SDKFakeCardBrand.Discover,
cvmResult = SDKCvmResult.NO_CVM
)

providesContactWithSingleEmvApp

Creates a contact card with a single EMV application. This method simulates a contact card for testing scenarios that involve inserting a card into a reader with a single EMV application.

Parameters:

  • cardBrand (SDKFakeCardBrand): The brand of the card.
  • cvmResult (SDKCvmResult): The CVM result for the card.

Returns:

  • SDKFakeCard.Emv.Contact: A fake contact card object with predefined attributes.
val card = SDKFakeCardProvider.providesContactWithSingleEmvApp(
cardBrand = SDKFakeCardBrand.Visa,
cvmResult = SDKCvmResult.PIN
)

providesContactWithMultipleEmvApps

Creates a contact card with multiple EMV applications. This method simulates a contact card for testing scenarios that involve selecting an EMV application during a transaction.

Parameters:

  • cardBrand (SDKFakeCardBrand): The brand of the card.
  • cvmResult (SDKCvmResult): The CVM result for the card.

Returns:

  • SDKFakeCard.Emv.Contact: A fake contact card object with predefined attributes.
val card = SDKFakeCardProvider.providesContactWithMultipleEmvApps(
cardBrand = SDKFakeCardBrand.Master,
cvmResult = SDKCvmResult.NO_CVM
)